package com.kt.delivery.controller;


import com.kt.delivery.domain.R;
import com.kt.delivery.domain.vo.LoginUser;
import com.kt.delivery.service.LoginUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;

@RestController
@RequestMapping("/api/delicery")
@RequiredArgsConstructor
public class LoginController {

    private final LoginUserService loginUserService;


    /**
     * 微信小程序登陆
     * @param code code
     * @return 结果
     */
    @PostMapping("/login")
    public R<LoginUser> login(@RequestBody Map<String,Object> map) throws Exception {
        return loginUserService.checkLogin((String) map.get("code"));
    }
}
